﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using SlimDX;
using D3D = SlimDX.Direct3D10;

namespace SCS.GFX {

  [StructLayout(LayoutKind.Sequential)]
  public struct PositionTextured {

    public static int SizeInBytes = Marshal.SizeOf(typeof(PositionTextured));
    public static D3D.InputElement[] InputElements = new D3D.InputElement[]{
				new D3D.InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, 0, 0),
				new D3D.InputElement("TEXCOORD", 0, SlimDX.DXGI.Format.R32G32_Float, 12, 0)
    };
      

    private Vector3 FPosition;
    public Vector3 Position
    {
    	get {	return FPosition; }
    	set { FPosition = value;}
    }
    
   
    public float X{
    	get {	return FPosition.X; }
    	set { FPosition.X = value;}
    }
    
    public float Y{
    	get {	return FPosition.Y; }
    	set { FPosition.Y = value;}
    }

    public float Z{
    	get {	return FPosition.Z; }
    	set { FPosition.Z = value;}
    }

    private Vector2 FTex;
    public float Tu{
    	get {	return FTex.X; }
    	set { FTex.X = value;}
    }
    
    public float Tv{
    	get {	return FTex.Y; }
      set { FTex.Y = value; }
    }
    
    public PositionTextured(Vector3 aPosition, float aTu, float aTv){
      FPosition = aPosition;
      FTex = new Vector2(aTu, aTv);
    }
    
    public PositionTextured(float aX, float aY, float aZ, float aTu, float aTv){
      FPosition = new Vector3(aX, aY, aZ);
      FTex = new Vector2(aTu, aTv);
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder(base.ToString());
      sb.Append(" Position=");
      sb.Append(FPosition.ToString());
      sb.Append(" Tex=");
      sb.Append(FTex.ToString());
      return sb.ToString();
    }

  }
}
